home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / HFS Volume Format ƒ / HFSVolumesPriv.a < prev    next >
Encoding:
Text File  |  1997-10-01  |  22.7 KB  |  485 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        HFSVolumesPriv.a
  3. ;
  4. ;    Contains:    On-disk data structures for HFS and HFS Plus volumes.
  5. ;
  6. ;    Version:    Technology:    
  7. ;                Release:    8.1a3c2
  8. ;
  9. ;    Copyright:    © 1984-1997 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__HFSVOLUMESPRIV__') = 'UNDEFINED' THEN
  19. __HFSVOLUMESPRIV__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  25.     include 'Files.a'
  26.     ENDIF
  27.     IF &TYPE('__FINDER__') = 'UNDEFINED' THEN
  28.     include 'Finder.a'
  29.     ENDIF
  30.  
  31.  
  32. ;  Signatures used to differentiate between HFS and HFS Plus volumes 
  33.  
  34. kHFSSigWord                        EQU        $4244                ; 'BD' in ASCII 
  35. kHFSPlusSigWord                    EQU        $482B                ; 'H+' in ASCII 
  36. kHFSPlusVersion                    EQU        $0003                ; will change as format changes 
  37. kHFSPlusMountVersion            EQU        '8.01'                ; will change as implementations change 
  38.  
  39. ;  CatalogNodeID is used to track catalog objects 
  40. ; typedef UInt32                         CatalogNodeID
  41.  
  42. ;  Unicode strings are used for file and folder names (HFS Plus only) 
  43. UniStr255                RECORD 0
  44. length                     ds.w    1                ; offset: $0 (0)        ;  number of unicode characters 
  45. unicode                     ds.w    255                ; offset: $2 (2)        ;  unicode characters 
  46. sizeof                     EQU *                    ; size:   $200 (512)
  47.                         ENDR
  48. ; typedef const struct UniStr255 *        ConstUniStr255Param
  49.  
  50.  
  51. kHFSMaxVolumeNameChars            EQU        27
  52. kHFSMaxFileNameChars            EQU        31
  53. kHFSPlusMaxFileNameChars        EQU        255
  54. CMMaxCName                        EQU        31                    ;•• this will go away 
  55.  
  56. ;  Extent overflow file data structures 
  57. ;  Small Extent key (HFS only) 
  58. SmallExtentKey            RECORD 0
  59. keyLength                 ds.b    1                ; offset: $0 (0)        ;  length of key, excluding this field 
  60. forkType                 ds.b    1                ; offset: $1 (1)        ;  0 = data fork, FF = resource fork 
  61. fileID                     ds.l    1                ; offset: $2 (2)        ;  file ID 
  62. startBlock                 ds.w    1                ; offset: $6 (6)        ;  first file allocation block number in this extent 
  63. sizeof                     EQU *                    ; size:   $8 (8)
  64.                         ENDR
  65. ;  Large Extent key (HFS Plus only) 
  66. LargeExtentKey            RECORD 0
  67. keyLength                 ds.w    1                ; offset: $0 (0)        ;  length of key, excluding this field 
  68. forkType                 ds.b    1                ; offset: $2 (2)        ;  0 = data fork, FF = resource fork 
  69. pad                         ds.b    1                ; offset: $3 (3)        ;  make the other fields align on 32-bit boundary 
  70. fileID                     ds.l    1                ; offset: $4 (4)        ;  file ID 
  71. startBlock                 ds.l    1                ; offset: $8 (8)        ;  first file allocation block number in this extent 
  72. sizeof                     EQU *                    ; size:   $C (12)
  73.                         ENDR
  74. ;  Universal Extent Key 
  75. ExtentKey                RECORD 0
  76. small                     ds        SmallExtentKey ; offset: $0 (0)
  77.                          ORG 0
  78. large                     ds        LargeExtentKey ; offset: $0 (0)
  79. sizeof                     EQU *                    ; size:   $C (12)
  80.                         ENDR
  81.  
  82. kSmallExtentDensity                EQU        3
  83. kLargeExtentDensity                EQU        8
  84. ;  Small extent descriptor (HFS only) 
  85. SmallExtentDescriptor    RECORD 0
  86. startBlock                 ds.w    1                ; offset: $0 (0)        ;  first allocation block 
  87. blockCount                 ds.w    1                ; offset: $2 (2)        ;  number of allocation blocks 
  88. sizeof                     EQU *                    ; size:   $4 (4)
  89.                         ENDR
  90. ;  Large extent descriptor (HFS Plus only) 
  91. LargeExtentDescriptor    RECORD 0
  92. startBlock                 ds.l    1                ; offset: $0 (0)        ;  first allocation block 
  93. blockCount                 ds.l    1                ; offset: $4 (4)        ;  number of allocation blocks 
  94. sizeof                     EQU *                    ; size:   $8 (8)
  95.                         ENDR
  96. ;  Universal extent descriptor 
  97. ExtentDescriptor        RECORD 0
  98. small                     ds        SmallExtentDescriptor ; offset: $0 (0)
  99.                          ORG 0
  100. large                     ds        LargeExtentDescriptor ; offset: $0 (0)
  101. sizeof                     EQU *                    ; size:   $8 (8)
  102.                         ENDR
  103. ;  Small extent record (HFS only) 
  104. SmallExtentRecord        RECORD 0
  105. elements                 ds.b    3 * SmallExtentDescriptor.sizeof
  106. sizeof                     EQU *                    ; size:   $C (12)
  107.                         ENDR
  108.  
  109.  
  110. ;  Large extent record (HFS Plus only) 
  111. LargeExtentRecord        RECORD 0
  112. elements                 ds.b    8 * LargeExtentDescriptor.sizeof
  113. sizeof                     EQU *                    ; size:   $40 (64)
  114.                         ENDR
  115.  
  116.  
  117. ;  Universal extent record 
  118. ExtentRecord            RECORD 0
  119. small                     ds        SmallExtentRecord ; offset: $0 (0)
  120.                          ORG 0
  121. large                     ds        LargeExtentRecord ; offset: $0 (0)
  122. sizeof                     EQU *                    ; size:   $40 (64)
  123.                         ENDR
  124.  
  125. ;  Fork data info (HFS Plus only) - 80 bytes 
  126. ForkData                RECORD 0
  127. logicalSize                 ds        UInt64            ; offset: $0 (0)        ;  fork's logical size in bytes 
  128. clumpSize                 ds.l    1                ; offset: $8 (8)        ;  fork's clump size in bytes 
  129. totalBlocks                 ds.l    1                ; offset: $C (12)        ;  total blocks used by this fork 
  130. extents                     ds        LargeExtentRecord ; offset: $10 (16)    ;  initial set of extents 
  131. sizeof                     EQU *                    ; size:   $50 (80)
  132.                         ENDR
  133. ;  Permissions info (HFS Plus only) - 16 bytes 
  134. Permissions                RECORD 0
  135. ownerID                     ds.l    1                ; offset: $0 (0)        ;  user or group ID of file/folder owner 
  136. groupID                     ds.l    1                ; offset: $4 (4)        ;  additional user of group ID 
  137. permissions                 ds.l    1                ; offset: $8 (8)        ;  permissions (bytes: unused, owner, group, everyone) 
  138. specialDevice             ds.l    1                ; offset: $C (12)        ;  UNIX: device for character or block special file 
  139. sizeof                     EQU *                    ; size:   $10 (16)
  140.                         ENDR
  141. ;  Catalog file data structures 
  142.  
  143. kHFSRootParentID                EQU        1                    ; Parent ID of the root folder 
  144. kHFSRootFolderID                EQU        2                    ; Folder ID of the root folder 
  145. kHFSExtentsFileID                EQU        3                    ; File ID of the extents file 
  146. kHFSCatalogFileID                EQU        4                    ; File ID of the catalog file 
  147. kHFSBadBlockFileID                EQU        5                    ; File ID of the bad allocation block file 
  148. kHFSAllocationFileID            EQU        6                    ; File ID of the allocation file (HFS Plus only) 
  149. kHFSStartupFileID                EQU        7                    ; File ID of the startup file (HFS Plus only) 
  150. kHFSAttributesFileID            EQU        8                    ; File ID of the attribute file (HFS Plus only) 
  151. kBogusExtentFileID                EQU        15                    ; Used for exchanging extents in extents file 
  152. kFirstFreeCatalogNodeID            EQU        16
  153.  
  154. ;  Small catalog key (HFS only) 
  155. SmallCatalogKey            RECORD 0
  156. keyLength                 ds.b    1                ; offset: $0 (0)        ;  key length (in bytes) 
  157. reserved                 ds.b    1                ; offset: $1 (1)        ;  reserved (set to zero) 
  158. parentID                 ds.l    1                ; offset: $2 (2)        ;  parent folder ID 
  159. nodeName                 ds        Str31            ; offset: $6 (6)        ;  catalog node name 
  160. sizeof                     EQU *                    ; size:   $26 (38)
  161.                         ENDR
  162. ;  Large catalog key (HFS Plus only) 
  163. LargeCatalogKey            RECORD 0
  164. keyLength                 ds.w    1                ; offset: $0 (0)        ;  key length (in bytes) 
  165. parentID                 ds.l    1                ; offset: $2 (2)        ;  parent folder ID 
  166. nodeName                 ds        UniStr255        ; offset: $6 (6)        ;  catalog node name 
  167. sizeof                     EQU *                    ; size:   $206 (518)
  168.                         ENDR
  169. ;  Universal catalog key 
  170. CatalogKey                RECORD 0
  171. small                     ds        SmallCatalogKey ; offset: $0 (0)
  172.                          ORG 0
  173. large                     ds        LargeCatalogKey ; offset: $0 (0)
  174. sizeof                     EQU *                    ; size:   $206 (518)
  175.                         ENDR
  176.  
  177. ;  Catalog record types 
  178.  
  179.                                                             ; HFS Catalog Records 
  180. kSmallFolderRecord                EQU        $0100                ; Folder record 
  181. kSmallFileRecord                EQU        $0200                ; File record 
  182. kSmallFolderThreadRecord        EQU        $0300                ; Folder thread record 
  183. kSmallFileThreadRecord            EQU        $0400                ; File thread record 
  184.                                                             ; HFS Plus Catalog Records 
  185. kLargeFolderRecord                EQU        1                    ; Folder record 
  186. kLargeFileRecord                EQU        2                    ; File record 
  187. kLargeFolderThreadRecord        EQU        3                    ; Folder thread record 
  188. kLargeFileThreadRecord            EQU        4                    ; File thread record 
  189.  
  190. ;  Catalog file record flags 
  191.  
  192. kFileLockedBit                    EQU        $0000                ; file is locked and cannot be written to 
  193. kFileLockedMask                    EQU        $0001
  194. kFileThreadExistsBit            EQU        $0001                ; a file thread record exists for this file 
  195. kFileThreadExistsMask            EQU        $0002
  196.  
  197. ;  Small catalog folder record (HFS only) - 70 bytes 
  198. SmallCatalogFolder        RECORD 0
  199. recordType                 ds.w    1                ; offset: $0 (0)        ;  record type 
  200. flags                     ds.w    1                ; offset: $2 (2)        ;  folder flags 
  201. valence                     ds.w    1                ; offset: $4 (4)        ;  folder valence 
  202. folderID                 ds.l    1                ; offset: $6 (6)        ;  folder ID 
  203. createDate                 ds.l    1                ; offset: $A (10)        ;  date and time of creation 
  204. modifyDate                 ds.l    1                ; offset: $E (14)        ;  date and time of last modification 
  205. backupDate                 ds.l    1                ; offset: $12 (18)        ;  date and time of last backup 
  206. userInfo                 ds        DInfo            ; offset: $16 (22)        ;  Finder information 
  207. finderInfo                 ds        DXInfo            ; offset: $26 (38)        ;  additional Finder information 
  208. reserved                 ds.l    4                ; offset: $36 (54)        ;  reserved - set to zero 
  209. sizeof                     EQU *                    ; size:   $46 (70)
  210.                         ENDR
  211. ;  Large catalog folder record (HFS Plus only) - 88 bytes 
  212. LargeCatalogFolder        RECORD 0
  213. recordType                 ds.w    1                ; offset: $0 (0)        ;  record type = HFS Plus folder record 
  214. flags                     ds.w    1                ; offset: $2 (2)        ;  file flags 
  215. valence                     ds.l    1                ; offset: $4 (4)        ;  folder's valence (limited to 2^16 in Mac OS) 
  216. folderID                 ds.l    1                ; offset: $8 (8)        ;  folder ID 
  217. createDate                 ds.l    1                ; offset: $C (12)        ;  date and time of creation 
  218. contentModDate             ds.l    1                ; offset: $10 (16)        ;  date and time of last content modification 
  219. modifyDate                 ds.l    1                ; offset: $14 (20)        ;  date and time of last modification (any kind) 
  220. accessDate                 ds.l    1                ; offset: $18 (24)        ;  date and time of last access (Rhapsody only) 
  221. backupDate                 ds.l    1                ; offset: $1C (28)        ;  date and time of last backup 
  222. permissions                 ds        Permissions        ; offset: $20 (32)        ;  permissions (for Rhapsody) 
  223. userInfo                 ds        DInfo            ; offset: $30 (48)        ;  Finder information 
  224. finderInfo                 ds        DXInfo            ; offset: $40 (64)        ;  additional Finder information 
  225. textEncoding             ds.l    1                ; offset: $50 (80)        ;  hint for name conversions 
  226. reserved                 ds.l    1                ; offset: $54 (84)        ;  reserved - set to zero 
  227. sizeof                     EQU *                    ; size:   $58 (88)
  228.                         ENDR
  229. ;  Small catalog file record (HFS only) - 102 bytes 
  230. SmallCatalogFile        RECORD 0
  231. recordType                 ds.w    1                ; offset: $0 (0)        ;  record type 
  232. flags                     ds.b    1                ; offset: $2 (2)        ;  file flags 
  233. fileType                 ds.b    1                ; offset: $3 (3)        ;  file type (unused ?) 
  234. userInfo                 ds        FInfo            ; offset: $4 (4)        ;  Finder information 
  235. fileID                     ds.l    1                ; offset: $14 (20)        ;  file ID 
  236. dataStartBlock             ds.w    1                ; offset: $18 (24)        ;  not used - set to zero 
  237. dataLogicalSize             ds.l    1                ; offset: $1A (26)        ;  logical EOF of data fork 
  238. dataPhysicalSize         ds.l    1                ; offset: $1E (30)        ;  physical EOF of data fork 
  239. rsrcStartBlock             ds.w    1                ; offset: $22 (34)        ;  not used - set to zero 
  240. rsrcLogicalSize             ds.l    1                ; offset: $24 (36)        ;  logical EOF of resource fork 
  241. rsrcPhysicalSize         ds.l    1                ; offset: $28 (40)        ;  physical EOF of resource fork 
  242. createDate                 ds.l    1                ; offset: $2C (44)        ;  date and time of creation 
  243. modifyDate                 ds.l    1                ; offset: $30 (48)        ;  date and time of last modification 
  244. backupDate                 ds.l    1                ; offset: $34 (52)        ;  date and time of last backup 
  245. finderInfo                 ds        FXInfo            ; offset: $38 (56)        ;  additional Finder information 
  246. clumpSize                 ds.w    1                ; offset: $48 (72)        ;  file clump size (not used) 
  247. dataExtents                 ds        SmallExtentRecord ; offset: $4A (74)    ;  first data fork extent record 
  248. rsrcExtents                 ds        SmallExtentRecord ; offset: $56 (86)    ;  first resource fork extent record 
  249. reserved                 ds.l    1                ; offset: $62 (98)        ;  reserved - set to zero 
  250. sizeof                     EQU *                    ; size:   $66 (102)
  251.                         ENDR
  252. ;  Large catalog file record (HFS Plus only) - 248 bytes 
  253. LargeCatalogFile        RECORD 0
  254. recordType                 ds.w    1                ; offset: $0 (0)        ;  record type = HFS Plus file record 
  255. flags                     ds.w    1                ; offset: $2 (2)        ;  file flags 
  256. reserved1                 ds.l    1                ; offset: $4 (4)        ;  number of links (normally just one) 
  257. fileID                     ds.l    1                ; offset: $8 (8)        ;  file ID 
  258. createDate                 ds.l    1                ; offset: $C (12)        ;  date and time of creation 
  259. contentModDate             ds.l    1                ; offset: $10 (16)        ;  date and time of last content modification 
  260. modifyDate                 ds.l    1                ; offset: $14 (20)        ;  date and time of last modification (any kind) 
  261. accessDate                 ds.l    1                ; offset: $18 (24)        ;  date and time of last access (Rhapsody only) 
  262. backupDate                 ds.l    1                ; offset: $1C (28)        ;  date and time of last backup 
  263. permissions                 ds        Permissions        ; offset: $20 (32)        ;  permissions (for Rhapsody) 
  264. userInfo                 ds        FInfo            ; offset: $30 (48)        ;  Finder information 
  265. finderInfo                 ds        FXInfo            ; offset: $40 (64)        ;  additional Finder information 
  266. textEncoding             ds.l    1                ; offset: $50 (80)        ;  hint for name conversions 
  267. reserved2                 ds.l    1                ; offset: $54 (84)        ;  reserved - set to zero 
  268. ;  start on double long (64 bit) boundry 
  269. dataFork                 ds        ForkData        ; offset: $58 (88)        ;  size and block data for data fork 
  270. resourceFork             ds        ForkData        ; offset: $A8 (168)        ;  size and block data for resource fork 
  271. sizeof                     EQU *                    ; size:   $F8 (248)
  272.                         ENDR
  273. ;  Small catalog thread record (HFS only) - 46 bytes 
  274. SmallCatalogThread        RECORD 0
  275. recordType                 ds.w    1                ; offset: $0 (0)        ;  record type 
  276. reserved                 ds.l    2                ; offset: $2 (2)        ;  reserved - set to zero 
  277. parentID                 ds.l    1                ; offset: $A (10)        ;  parent ID for this catalog node 
  278. nodeName                 ds        Str31            ; offset: $E (14)        ;  name of this catalog node 
  279. sizeof                     EQU *                    ; size:   $2E (46)
  280.                         ENDR
  281. ;  Large catalog thread record (HFS Plus only) -- 264 bytes 
  282. LargeCatalogThread        RECORD 0
  283. recordType                 ds.w    1                ; offset: $0 (0)        ;  record type 
  284. reserved                 ds.w    1                ; offset: $2 (2)        ;  reserved - set to zero 
  285. parentID                 ds.l    1                ; offset: $4 (4)        ;  parent ID for this catalog node 
  286. nodeName                 ds        UniStr255        ; offset: $8 (8)        ;  name of this catalog node (variable length) 
  287. sizeof                     EQU *                    ; size:   $208 (520)
  288.                         ENDR
  289. ;  Universal catalog data record 
  290. CatalogRecord            RECORD 0
  291. recordType                 ds.w    1                ; offset: $0 (0)
  292.                          ORG 0
  293. smallFolder                 ds        SmallCatalogFolder ; offset: $0 (0)
  294.                          ORG 0
  295. smallFile                 ds        SmallCatalogFile ; offset: $0 (0)
  296.                          ORG 0
  297. smallThread                 ds        SmallCatalogThread ; offset: $0 (0)
  298.                          ORG 0
  299. largeFolder                 ds        LargeCatalogFolder ; offset: $0 (0)
  300.                          ORG 0
  301. largeFile                 ds        LargeCatalogFile ; offset: $0 (0)
  302.                          ORG 0
  303. largeThread                 ds        LargeCatalogThread ; offset: $0 (0)
  304. sizeof                     EQU *                    ; size:   $208 (520)
  305.                         ENDR
  306.  
  307. ;      Key for records in the attributes file.  Fields are compared in the order:
  308. ;          cnid, attributeName, startBlock
  309.  
  310.  
  311. AttributeKey            RECORD 0
  312. keyLength                 ds.w    1                ; offset: $0 (0)        ;  must set kBTBigKeysMask and kBTVariableIndexKeysMask in BTree header's attributes 
  313. pad                         ds.w    1                ; offset: $2 (2)
  314. cnid                     ds.l    1                ; offset: $4 (4)        ;  file or folder ID 
  315. startBlock                 ds.l    1                ; offset: $8 (8)        ;  block # relative to start of attribute 
  316. attributeName             ds        UniStr255        ; offset: $C (12)        ;  variable length 
  317. sizeof                     EQU *                    ; size:   $20C (524)
  318.                         ENDR
  319.  
  320. ;      These are the types of records in the attribute B-tree.  The values were chosen
  321. ;      so that they wouldn't conflict with the catalog record types.
  322.  
  323.  
  324.  
  325. kAttributeInlineData            EQU        $10                    ; if size <  kAttrOverflowSize 
  326. kAttributeForkData                EQU        $20                    ; if size >= kAttrOverflowSize 
  327. kAttributeExtents                EQU        $30                    ; overflow extents for large attributes 
  328.  
  329.  
  330. ;      AttributeInlineData
  331. ;      For small attributes, whose entire value is stored within this one
  332. ;      B-tree record.  The key for this record is of the form:
  333. ;          { CNID, name, 0 }.        (startBlock == 0)
  334. ;      There would not be any other records for this attribute.
  335.  
  336.  
  337. AttributeInlineData        RECORD 0
  338. recordType                 ds.l    1                ; offset: $0 (0)        ;     = kAttributeInlineData
  339. logicalSize                 ds.l    1                ; offset: $4 (4)        ;     size in bytes of userData
  340. userData                 ds.b    2                ; offset: $8 (8)        ;     variable length; space allocated is a multiple of 2 bytes
  341. sizeof                     EQU *                    ; size:   $A (10)
  342.                         ENDR
  343.  
  344. ;      AttributeForkData
  345. ;      For larger attributes, whose value is stored in allocation blocks.
  346. ;      The key for this record is of the form:
  347. ;          { CNID, name, 0 }.        (startBlock == 0)
  348. ;      If the attribute has more than 8 extents, there will be additonal
  349. ;      records (of type AttributeExtents) for this attribute.
  350.  
  351.  
  352. AttributeForkData        RECORD 0
  353. recordType                 ds.l    1                ; offset: $0 (0)        ;     = kAttributeForkData
  354. reserved                 ds.l    1                ; offset: $4 (4)
  355. theFork                     ds        ForkData        ; offset: $8 (8)        ;     size and first extents of value
  356. sizeof                     EQU *                    ; size:   $58 (88)
  357.                         ENDR
  358.  
  359. ;      AttributeExtents
  360. ;      This record contains information about overflow extents for large,
  361. ;      fragmented attributes.  The key for this record is of the form:
  362. ;          { CNID, name, !=0 }.    (startBlock != 0)
  363. ;      The startBlock field of the key is the first allocation block number
  364. ;      (relative to the start of the attribute value) represented by the
  365. ;      extents in this record.
  366.  
  367.  
  368. AttributeExtents        RECORD 0
  369. recordType                 ds.l    1                ; offset: $0 (0)        ;     = kAttributeExtents
  370. reserved                 ds.l    1                ; offset: $4 (4)
  371. extents                     ds        LargeExtentRecord ; offset: $8 (8)        ;     additional extents
  372. sizeof                     EQU *                    ; size:   $48 (72)
  373.                         ENDR
  374. ;     A generic Attribute Record
  375. AttributeRecord            RECORD 0
  376. recordType                 ds.l    1                ; offset: $0 (0)
  377.                          ORG 0
  378. inlineData                 ds        AttributeInlineData ; offset: $0 (0)
  379.                          ORG 0
  380. forkData                 ds        AttributeForkData ; offset: $0 (0)
  381.                          ORG 0
  382. overflowExtents             ds        AttributeExtents ; offset: $0 (0)
  383.                          ORG 88
  384. sizeof                     EQU *                    ; size:   $58 (88)
  385.                         ENDR
  386. ;  Key and node lengths 
  387.  
  388. kLargeExtentKeyMaximumLength    EQU        10
  389. kSmallExtentKeyMaximumLength    EQU        7
  390. kLargeCatalogKeyMaximumLength    EQU        516
  391. kLargeCatalogKeyMinimumLength    EQU        6
  392. kSmallCatalogKeyMaximumLength    EQU        37
  393. kSmallCatalogKeyMinimumLength    EQU        6
  394. kAttributeKeyMaximumLength        EQU        522
  395. kAttributeKeyMinimumLength        EQU        12
  396. kLargeCatalogMinimumNodeSize    EQU        4096
  397. kLargeExtentMinimumNodeSize        EQU        512
  398. kAttributeMinimumNodeSize        EQU        4096
  399.  
  400.  
  401.                                                             ; Bits 0-6 are reserved (always cleared by MountVol call) 
  402. kVolumeHardwareLockBit            EQU        7                    ; volume is locked by hardware 
  403. kVolumeUnmountedBit                EQU        8                    ; volume was successfully unmounted 
  404. kVolumeSparedBlocksBit            EQU        9                    ; volume has bad blocks spared 
  405. kVolumeNoCacheRequiredBit        EQU        10                    ; don't cache volume blocks (i.e. RAM or ROM disk) 
  406. kBootVolumeInconsistentBit        EQU        11                    ; boot volume is inconsistent (System 7.6) 
  407.                                                             ; Bits 12-14 are reserved for future use 
  408. kVolumeSoftwareLockBit            EQU        15                    ; volume is locked by software 
  409. kVolumeHardwareLockMask            EQU        $80
  410. kVolumeUnmountedMask            EQU        $0100
  411. kVolumeSparedBlocksMask            EQU        $0200
  412. kVolumeNoCacheRequiredMask        EQU        $0400
  413. kBootVolumeInconsistentMask        EQU        $0800
  414. kVolumeSoftwareLockMask            EQU        $8000
  415. kMDBAttributesMask                EQU        $8380
  416.  
  417. ;  Master Directory Block (HFS only) - 162 bytes 
  418. ;  Stored at sector #2 (3rd sector) 
  419. MasterDirectoryBlock    RECORD 0
  420. drSigWord                 ds.w    1                ; offset: $0 (0)        ;  volume signature 
  421. drCrDate                 ds.l    1                ; offset: $2 (2)        ;  date and time of volume creation 
  422. drLsMod                     ds.l    1                ; offset: $6 (6)        ;  date and time of last modification 
  423. drAtrb                     ds.w    1                ; offset: $A (10)        ;  volume attributes 
  424. drNmFls                     ds.w    1                ; offset: $C (12)        ;  number of files in root folder 
  425. drVBMSt                     ds.w    1                ; offset: $E (14)        ;  first block of volume bitmap 
  426. drAllocPtr                 ds.w    1                ; offset: $10 (16)        ;  start of next allocation search 
  427. drNmAlBlks                 ds.w    1                ; offset: $12 (18)        ;  number of allocation blocks in volume 
  428. drAlBlkSiz                 ds.l    1                ; offset: $14 (20)        ;  size (in bytes) of allocation blocks 
  429. drClpSiz                 ds.l    1                ; offset: $18 (24)        ;  default clump size 
  430. drAlBlSt                 ds.w    1                ; offset: $1C (28)        ;  first allocation block in volume 
  431. drNxtCNID                 ds.l    1                ; offset: $1E (30)        ;  next unused catalog node ID 
  432. drFreeBks                 ds.w    1                ; offset: $22 (34)        ;  number of unused allocation blocks 
  433. drVN                     ds        Str27            ; offset: $24 (36)        ;  volume name 
  434. ;  Master Directory Block extensions for HFS 
  435. drVolBkUp                 ds.l    1                ; offset: $40 (64)        ;  date and time of last backup 
  436. drVSeqNum                 ds.w    1                ; offset: $44 (68)        ;  volume backup sequence number 
  437. drWrCnt                     ds.l    1                ; offset: $46 (70)        ;  volume write count 
  438. drXTClpSiz                 ds.l    1                ; offset: $4A (74)        ;  clump size for extents overflow file 
  439. drCTClpSiz                 ds.l    1                ; offset: $4E (78)        ;  clump size for catalog file 
  440. drNmRtDirs                 ds.w    1                ; offset: $52 (82)        ;  number of directories in root folder 
  441. drFilCnt                 ds.l    1                ; offset: $54 (84)        ;  number of files in volume 
  442. drDirCnt                 ds.l    1                ; offset: $58 (88)        ;  number of directories in volume 
  443. drFndrInfo                 ds.l    8                ; offset: $5C (92)        ;  information used by the Finder 
  444. drEmbedSigWord             ds.w    1                ; offset: $7C (124)        ;  embedded volume signature (formerly drVCSize) 
  445. drEmbedExtent             ds        SmallExtentDescriptor ; offset: $7E (126) ;  embedded volume location and size (formerly drVBMCSize and drCtlCSize) 
  446. drXTFlSize                 ds.l    1                ; offset: $82 (130)        ;  size of extents overflow file 
  447. drXTExtRec                 ds        SmallExtentRecord ; offset: $86 (134)    ;  extent record for extents overflow file 
  448. drCTFlSize                 ds.l    1                ; offset: $92 (146)        ;  size of catalog file 
  449. drCTExtRec                 ds        SmallExtentRecord ; offset: $96 (150)    ;  extent record for catalog file 
  450. sizeof                     EQU *                    ; size:   $A2 (162)
  451.                         ENDR
  452. ;  VolumeHeader (HFS Plus only) - 512 bytes 
  453. ;  Stored at sector #0 (1st sector) and last sector 
  454. VolumeHeader            RECORD 0
  455. signature                 ds.w    1                ; offset: $0 (0)        ;  volume signature == 'H+' 
  456. version                     ds.w    1                ; offset: $2 (2)        ;  current version is kHFSPlusVersion 
  457. attributes                 ds.l    1                ; offset: $4 (4)        ;  volume attributes 
  458. lastMountedVersion         ds.l    1                ; offset: $8 (8)        ;  implementation version which last mounted volume 
  459. reserved                 ds.l    1                ; offset: $C (12)        ;  reserved - set to zero 
  460. createDate                 ds.l    1                ; offset: $10 (16)        ;  date and time of volume creation 
  461. modifyDate                 ds.l    1                ; offset: $14 (20)        ;  date and time of last modification 
  462. backupDate                 ds.l    1                ; offset: $18 (24)        ;  date and time of last backup 
  463. checkedDate                 ds.l    1                ; offset: $1C (28)        ;  date and time of last disk check 
  464. fileCount                 ds.l    1                ; offset: $20 (32)        ;  number of files in volume 
  465. folderCount                 ds.l    1                ; offset: $24 (36)        ;  number of directories in volume 
  466. blockSize                 ds.l    1                ; offset: $28 (40)        ;  size (in bytes) of allocation blocks 
  467. totalBlocks                 ds.l    1                ; offset: $2C (44)        ;  number of allocation blocks in volume (includes this header and VBM
  468. freeBlocks                 ds.l    1                ; offset: $30 (48)        ;  number of unused allocation blocks 
  469. nextAllocation             ds.l    1                ; offset: $34 (52)        ;  start of next allocation search 
  470. rsrcClumpSize             ds.l    1                ; offset: $38 (56)        ;  default resource fork clump size 
  471. dataClumpSize             ds.l    1                ; offset: $3C (60)        ;  default data fork clump size 
  472. nextCatalogID             ds.l    1                ; offset: $40 (64)        ;  next unused catalog node ID 
  473. writeCount                 ds.l    1                ; offset: $44 (68)        ;  volume write count 
  474. encodingsBitmap             ds        UInt64            ; offset: $48 (72)        ;  which encodings have been use  on this volume 
  475. finderInfo                 ds.b    32                ; offset: $50 (80)        ;  information used by the Finder 
  476. allocationFile             ds        ForkData        ; offset: $70 (112)        ;  allocation bitmap file 
  477. extentsFile                 ds        ForkData        ; offset: $C0 (192)        ;  extents B-tree file 
  478. catalogFile                 ds        ForkData        ; offset: $110 (272)    ;  catalog B-tree file 
  479. attributesFile             ds        ForkData        ; offset: $160 (352)    ;  extended attributes B-tree file 
  480. startupFile                 ds        ForkData        ; offset: $1B0 (432)    ;  boot file 
  481. sizeof                     EQU *                    ; size:   $200 (512)
  482.                         ENDR
  483.     ENDIF ; __HFSVOLUMESPRIV__ 
  484.  
  485.